#ifndef CVOLUMEBUTTON_H
#define CVOLUMEBUTTON_H

#include "cvolumedialog.h"
#include "vlckits.h"

#include <QPushButton>

class CVolumeButton : public QPushButton
{
    Q_OBJECT
public:
    explicit CVolumeButton(QWidget *parent = nullptr);
    ~CVolumeButton();

    void setVLC(VLCKits *vlcKits);

signals:
    void volume(int value);
private slots:
    //音量按钮被按下时槽函数
    void clickSlot() ;

protected:
    void paintEvent(QPaintEvent* event) override;
    void enterEvent(QEvent* event) override;
    //void leaveEvent(QEvent *event) override;
    //重写定时器函数
    void timerEvent(QTimerEvent* event) override;
private:
    void hide();
    int _timerId = 0;//定时器id
    bool _isRunning = false;//定时器开启的标志位
    bool _isMute = false;//是否静音
    int  _volumeValue = 0;//音量值

private:
    CVolumeSliderDialog * _pvolumeSliderDlg;

    VLCKits *_vlcKits;

    bool isconnect = true;
};

#endif // CVOLUMEBUTTON_H
